package com.floreantpos.main;

import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

public class Main {

  /**
   * @param args
   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
    Boolean hwCheck = true;
    try {
      Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();

      while (interfaces.hasMoreElements()) {
        NetworkInterface nif = interfaces.nextElement();
        byte[] lBytes = nif.getHardwareAddress();
        StringBuffer lStringBuffer = new StringBuffer();

        if (lBytes != null) {
          for (byte b : lBytes) {
            lStringBuffer.append(String.format("%1$02X ", new Byte(b)));
          }
        }
        if (lStringBuffer.indexOf("00 00 00 00 00 00") == 0) {
          hwCheck = true;
        }
      }
    } catch (SocketException ex) {
      Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex);
    }
    if (hwCheck) {
      Application application = Application.getInstance();
      application.start();
    } else {
      JOptionPane.showMessageDialog(null, "Instalação não reconhecida, não é possível continuar.", "Erro", JOptionPane.ERROR_MESSAGE);
    }
  }
}
